-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
txn: fix retry with non autocommit #22875
txn: fix retry with non autocommit #22875
Conversation
/run-all-tests |
session/session.go
Outdated
@@ -2257,6 +2250,7 @@ func (s *session) InitTxnWithStartTS(startTS uint64) error { | |||
if err != nil { | |||
return err | |||
} | |||
s.initTxn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this bring some side effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @tiancaiamao , thx!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To lower the risk, changes to NewTxn
and initTxnWithStartTS
are removed.
Agree with it. We can merge changes of this PR to master. |
The set autocommit = 0;
select * from t;
set @a=@@tidb_current_ts;
update t set startts = @a where xxx;
commit; If the above transaction retried, the column |
ef78bfc
to
d4cbe9d
Compare
/run-all-tests |
LGTM |
@coocood: Please use If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@AilinKid: Please use If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/LGTM |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jackysp: Please use If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/run-all-tests |
/LGTM |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/LGTM |
/label cherry-pick-approved |
/merge |
@jebter: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 8f8d450
|
What problem does this PR solve?
Issue Number: close #22874
Problem Summary:
The txn retry for non autocommit mode does not set flag correctly like
mysql.ServerStatusInTrans
.What is changed and how it works?
What's Changed:
Try to make transaction activiation use the same logic for common and retrying transactions.Make multiple transaction activiation interfaces use the same inner activiation logic, avoid maintaining duplicate codes.(There is still some refactor work need to do for this part, these transaction interfaces are diffuicult to distinguish and use).There are three different transaction activiation interfaces,NewTxn
,txn.Txn(true)
,initTxnWithStartTS
, and they have some their own initilizing logic.How it Works:
Related changes
Check List
Tests
Side effects
Release note